﻿<UserControl x:Class="ViewQueryGenerator"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.Resources>
            <StackPanel x:Key="transSP">
                <TextBlock Text="{Binding}" />
                <ComboBox SelectedIndex="0" >
                    <ComboBoxItem Content="NONE" />
                    <ComboBoxItem Content="MEAN" />
                    <ComboBoxItem Content="COUNT" />
                    <ComboBoxItem Content="STDEV" />
                    <ComboBoxItem Content="MIN" />
                    <ComboBoxItem Content="MAX" />
                </ComboBox>
            </StackPanel>
        </Grid.Resources>
    <Grid>
        <Grid.Resources>
            <CollectionViewSource x:Key="Columns" Source="{Binding Columns}">
                <CollectionViewSource.GroupDescriptions>
                    <PropertyGroupDescription PropertyName="DATA_TYPE"   />
                </CollectionViewSource.GroupDescriptions>
               
            </CollectionViewSource>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="5" />
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="5" />
            <RowDefinition />
            </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="5" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <GridSplitter HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="1" Grid.RowSpan="5"   />
        <GridSplitter HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.ColumnSpan="3"  Grid.Row="1" />
        <GridSplitter HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.ColumnSpan="3"    Grid.Row="3"/>
        
        <ListBox Name="ListBox2" ItemsSource="{Binding Source={StaticResource Columns}}"
                 DisplayMemberPath="COLUMN_NAME" 
                 AlternationCount="1" Grid.RowSpan="5" >
            <ListBox.ItemContainerStyle>
                <Style TargetType="ListBoxItem" >
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="ListBoxItem">
                                <Border MouseLeftButtonDown="ColumnsMouseLeftButtonDown" Background="{TemplateBinding Background}" >
                                    <ContentPresenter ContentSource="Content" />
                                </Border>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>              
                    <Style.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Foreground" Value="White" />
                            <Setter Property="Background" Value="Black" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </ListBox.ItemContainerStyle>
        </ListBox>
        <ListBox Grid.Column="2" AllowDrop="True" Name="ListBox1" Drop="ListBox1_Drop"/>
            <ListBox Grid.Column="2" Grid.Row="4" AllowDrop="True" Name="ListBox3" Drop="ListBox1_Drop"/>
        </Grid>
        <Button Content="OK" Grid.Row="1" Name="Button1" />
    </Grid>
</UserControl>
